<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
       <p>
        品牌：<input v-model="info.name" type="text">
       </p>
       <p>
        价格：<input v-model="info.age" type="text">
       </p>
       <p>
        国别：<input v-model="info.sex" type="text">
       </p>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el: "#app",
            data: {
                val: "",
                info: {
                    name: "张三",
                    age: 20,
                    sex: 1
                }
            },
            // 实时监听 (监听的值发生改变的时候会执行)
            // watch 开启深度监听
            watch: {
                info: {
                    deep: true,
                    handler() {
                        console.log('我开启了深度监听')
                    }
                }
                // info() {
                //     console.log('对象发生改变了')
                // },
                // newValue  当前的值
                // oldValue  上一次的值
                // val(newValue, oldValue) {
                //     this.arr = this.arr.filter(item => {
                //         return item.includes(this.val)
                //     })
                // }
            }
        })


    </script>
</body>
</html>